import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:online_study/base/app_title.dart';
import 'package:online_study/mine/exam/exam_result.dart';
import 'package:online_study/mine/exam/start_exam.dart';
import 'package:online_study/theme/colors.dart';
import 'package:online_study/theme/size.dart';

//考试记录
class ExamHistoryPage extends StatefulWidget {
  @override
  _ExamHistoryPageState createState() => _ExamHistoryPageState();
}

class _ExamHistoryPageState extends State<ExamHistoryPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: BackButton(color: ThemeColor.color333333),
        titleSpacing: 0,
        elevation: ThemeSize.appElevation,
        backgroundColor: ThemeColor.colorWhite,
        title: AppTitle("考试记录"),
      ),
      body: ListView.separated(
          itemBuilder: (BuildContext context, int index) {
            return Container(
              color: ThemeColor.colorWhite,
              padding: EdgeInsets.symmetric(horizontal: ThemeSize.width19),
              height: ThemeSize.height105,
              child: Row(
                children: [
                  Expanded(
                      child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text("得分：98分",
                          style: TextStyle(
                              color: ThemeColor.color333333,
                              fontSize: ThemeSize.sp13,
                              fontWeight: FontWeight.bold)),
                      Container(
                        margin: EdgeInsets.only(top: ThemeSize.height6),
                        child: Text("商务谈判技巧一期考试",
                            style: TextStyle(
                                color: ThemeColor.color333333,
                                fontSize: ThemeSize.sp12,
                                fontWeight: FontWeight.bold)),
                      ),
                      Container(
                        margin: EdgeInsets.only(top: ThemeSize.height10),
                        child: Text("考试时长：45分钟  答题耗时：40分钟",
                            style: TextStyle(
                                color: ThemeColor.color555555,
                                fontSize: ThemeSize.sp10)),
                      ),
                      Container(
                        margin: EdgeInsets.only(top: ThemeSize.height6),
                        child: Text("考试时间范围：2020-12-09至2021-03-30",
                            style: TextStyle(
                                color: ThemeColor.color555555,
                                fontSize: ThemeSize.sp10)),
                      ),
                      Container(
                        margin: EdgeInsets.only(top: ThemeSize.height6),
                        child: Text("提交时间：2021-03-26 09:00",
                            style: TextStyle(
                                color: ThemeColor.color555555,
                                fontSize: ThemeSize.sp10)),
                      ),
                    ],
                  )),
                  Container(
                    padding: EdgeInsets.only(
                        top: ThemeSize.height14, bottom: ThemeSize.height8),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [
                        Expanded(
                            child: Container(
                          alignment: Alignment.topRight,
                          child: Text("及格",
                              style: TextStyle(
                                  color: ThemeColor.colorFA5151,
                                  fontSize: ThemeSize.sp13)),
                        )),
                        Row(
                          children: [
                            GestureDetector(
                              child: Container(
                                alignment: Alignment.center,
                                margin:
                                    EdgeInsets.only(right: ThemeSize.width15),
                                height: ThemeSize.height22,
                                width: ThemeSize.width50,
                                decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(
                                        ThemeSize.height12),
                                    color: ThemeColor.colorEEF7FF),
                                child: Text("重考",
                                    style: TextStyle(
                                        color: ThemeColor.color1485EE,
                                        fontSize: ThemeSize.sp10)),
                              ),
                              onTap: () {
                                Get.to(() => StartExamPage());
                              },
                            ),
                            GestureDetector(
                              child: Container(
                                alignment: Alignment.center,
                                height: ThemeSize.height22,
                                width: ThemeSize.width50,
                                decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(
                                        ThemeSize.height12),
                                    color: ThemeColor.color1485EE),
                                child: Text("详情",
                                    style: TextStyle(
                                        color: ThemeColor.colorWhite,
                                        fontSize: ThemeSize.sp10)),
                              ),
                              onTap: () {
                                Get.to(() => ExamResultPage());
                              },
                            ),
                          ],
                        )
                      ],
                    ),
                  )
                ],
              ),
            );
          },
          separatorBuilder: (BuildContext context, int index) {
            return Divider(height: ThemeSize.width1);
          },
          itemCount: 4,
          shrinkWrap: true),
    );
  }
}
